﻿<%@ Page Title="驾照翻译" Language="C#" MasterPageFile="~/master.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
    #frm1 {
        border: none;
        width: 100%;
        height: 100%;
        min-height: 800px;
        margin: 0;
        padding: 0;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph" Runat="Server">
<form id="form1" action="https://www.kthx.com.cn/Activity/avis" method="post" target="frm1">
    <input type="hidden" name="avisno" />
    <input type="hidden" name="godate" />
    <input type="hidden" name="backdate" />
    <input type="hidden" name="avisdays" />
    <input type="hidden" name="country" />
    <input type="hidden" name="pid" />
    <input type="hidden" name="flight" />
    <input type="hidden" name="username" />
    <input type="hidden" name="mobile" />
    <input type="hidden" name="email" />
    <input type="hidden" name="key" />
    <input type="hidden" name="callbackurl" />
</form>
<iframe id="frm1" name="frm1" src="about:blank"></iframe>
<script type="text/javascript">
    $(function () {
        var api = '/api/services/avis/thirdOrder/GetYouYouOrderByOrderNo?orderNo={0}&productId={1}';

        av.head('Avis-境外移动WiFi');
        $('[name="avisno"]').val(av.query('orderNo'));

        av.ajax({
            api: api.format(av.query('orderNo'), av.query('productId')),
            success: function (res) {
                $('[name="godate"]').val(res.pickupDateTime.date(5).replace(/\-/g, '/'));
                $('[name="backdate"]').val(res.returnDateTime.date(5).replace(/\-/g, '/'));
                $('[name="avisdays"]').val(getday(res.pickupDateTime, res.returnDateTime));
                $('[name="country"]').val(res.countryCode);
                $('[name="pid"]').val(res.productID);
                $('[name="flight"]').val(res.flightNumber);
                $('[name="username"]').val(res.surname + res.firstname);
                $('[name="mobile"]').val(res.telephone);
                $('[name="email"]').val(res.email);

                $('[name="key"]').val(res.key);
                $('#form1')[0].submit();

                var ss = av.query('orderNo') 
                    + $('[name="godate"]').val() 
                    + $('[name="backdate"]').val() 
                    + $('[name="avisdays"]').val();
                
            }
        });

        function getday(d1, d2) {
            var cc = (d2.date(1).getTime() - d1.date(1).getTime()) / 1000;
            var day = Math.ceil(cc / 60 / 60 / 24);
            if (day < 0) day = 0;
            if(day>15) day=15;
            return day;
        }
    });
</script>
</asp:Content>